package com.cloudlead.plugin.security.vo;

import com.cloudlead.common.lang.annotation.Domain;
import com.cloudlead.common.lang.annotation.Label;
import com.cloudlead.common.lang.annotation.Unique;
import com.cloudlead.common.lang.annotation.Uniques;
import com.cloudlead.common.lang.persistence.AbstractIdEntity;
import com.cloudlead.plugin.security.action.validator.ScUserValidatorGroup.Create;
import com.cloudlead.plugin.security.action.validator.ScUserValidatorGroup.Update;

import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

/**
 * ScUser is a Codegen vo type
 */
@Uniques(values = { @Unique("username"), @Unique("mobile"), @Unique("email") })
@Domain(domainClassName = "com.cloudlead.plugin.security.entity.EScUser")
@Label("用户")
public class ScUser extends AbstractIdEntity<String> {

	private static final long serialVersionUID = 6887012274641L;
	@Size(max = 255)
	@Label("邮箱地址")
	private String email;

	@Size(max = 24)
	@NotNull(groups = { Update.class })
	@Label("编号")
	private String id;

	@NotNull(groups = { Create.class, Update.class })
	@Label("是否锁定")
	private Boolean locked;

	@Size(max = 255)
	@Label("手机号码")
	private String mobile;

	@Size(max = 100)
	@NotNull(groups = { Create.class, Update.class })
	@Label("密码")
	private String password;

	@Size(max = 100)
	@Label("盐值")
	private String salt;

	@Size(max = 100)
	@NotNull(groups = { Create.class, Update.class })
	@Label("用户名")
	private String username;

    @Label("默认使用的组")
    @Size(max=24)
    private String defaultGroup;

	public String getEmail() {
		return email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public Boolean getLocked() {
		return locked;
	}

	public void setLocked(Boolean locked) {
		this.locked = locked;
	}

	public String getMobile() {
		return mobile;
	}

	public void setMobile(String mobile) {
		this.mobile = mobile;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public String getSalt() {
		return salt;
	}

	public void setSalt(String salt) {
		this.salt = salt;
	}

	public String getUsername() {
		return username;
	}

	public void setUsername(String username) {
		this.username = username;
	}

    public String getDefaultGroup() {
        return defaultGroup;
    }

    public void setDefaultGroup(String defaultGroup) {
        this.defaultGroup = defaultGroup;
    }

    public String toString() {
		return String
				.format("ScUser { email : %s,id : %s,locked : %s,mobile : %s,password : %s,salt : %s,username : %s }",
						email, id, locked, mobile, password, salt, username);
	}

}
